package com.nassir.chatroom.model;

import java.io.Serializable;
import java.net.Socket;

/**
 * 客户端实体
 * 
 * @author nassir.wen
 * @date 2012-12-5下午2:58:03
 * @Copyright: Copyright (c) 2012
 */
public class ClientModel implements Serializable {

	private static final long serialVersionUID = -5464471882170111276L;

	private Integer clientId;
	private String clientName;
	private Socket client;

	public ClientModel() {
	}

	public ClientModel(Integer clientId) {
		this.clientId = clientId;
	}

	public ClientModel(Integer clientId, String clientName) {
		this.clientId = clientId;
		this.clientName = clientName;
	}

	public Integer getClientId() {
		return clientId;
	}

	public void setClientId(Integer clientId) {
		this.clientId = clientId;
	}

	public String getClientName() {
		return clientName;
	}

	public void setClientName(String clientName) {
		this.clientName = clientName;
	}

	public Socket getClient() {
		return client;
	}

	public void setClient(Socket client) {
		this.client = client;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((client == null) ? 0 : client.hashCode());
		result = prime * result
				+ ((clientId == null) ? 0 : clientId.hashCode());
		result = prime * result
				+ ((clientName == null) ? 0 : clientName.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ClientModel other = (ClientModel) obj;
		if (clientId == null) {
			if (other.clientId != null)
				return false;
		} else if (!clientId.equals(other.clientId))
			return false;
		return true;
	}

}
